package com.ogawa.project2213n.activity

import android.view.View
import android.widget.TextView
import com.alibaba.android.arouter.facade.annotation.Route
 import com.ogawa.project2213N.base.Base2213NMqttActivity
import com.ogawa.projectcommon.constants.UrlPathConstant
 import com.ogawa.project2213n.R

@Route(path = UrlPathConstant.ACTIVITY_2213N_AUTO)
class AutoActivity : Base2213NMqttActivity(), View.OnClickListener {

    private var tvCurrent: TextView? = null
    private var program: String = ""

    override fun getLayoutId(): Int {
        return R.layout.activity_auto
    }

    override fun initView() {
        super.initView()
        setTitle(getString(R.string.auto_massage))
        findViewById<TextView>(R.id.tv_shoulder_neck_decompression).setOnClickListener(this)
        findViewById<TextView>(R.id.tv_sedentary_andrelaxed).setOnClickListener(this)
        findViewById<TextView>(R.id.tv_model_whole_body_is_comfortable).setOnClickListener(this)
        findViewById<TextView>(R.id.tv_elegant_body).setOnClickListener(this)
        findViewById<TextView>(R.id.tv_soothing).setOnClickListener(this)
        findViewById<TextView>(R.id.tv_cancel).setOnClickListener(this)
        findViewById<TextView>(R.id.tv_confirm).setOnClickListener(this)
        setProgram()
    }

    private fun setProgram() {
//        val deviceStatusBean = Massage2213NArmchair.getInstance().deviceStatusBean
//        if (deviceStatusBean != null) {
//            val auto = Integer.parseInt(deviceStatusBean.functions.autoProgram.modelValue)
//            tvDashi.isSelected = auto == 1
//            tvTaishi.isSelected = auto == 2
//            tvGuangjie.isSelected = auto == 3
//            tvShujin.isSelected = auto == 4
//            tvQingchen.isSelected = auto == 5
//            tvHuoli.isSelected = auto == 6
//            tvTaiji.isSelected = auto == 7
//            tvNvwang.isSelected = auto == 8
//            tvNanshi.isSelected = auto == 9
//            tvLaonian.isSelected = auto == 10
//            tvJapanese.isSelected = auto == 11
//            tvIndian.isSelected = auto == 12
//            tvParis.isSelected = auto == 13
//            tvChinese.isSelected = auto == 14
//            tvBangong.isSelected = auto == 15
//            tvDitou.isSelected = auto == 16
//            tvJiache.isSelected = auto == 17
//            tvGaogen.isSelected = auto == 18
//            when(auto){
//                1->tvCurrent=tvDashi
//                2->tvCurrent=tvTaishi
//                3->tvCurrent=tvGuangjie
//                4->tvCurrent=tvShujin
//                5->tvCurrent=tvQingchen
//                6->tvCurrent=tvHuoli
//                7->tvCurrent=tvTaiji
//                8->tvCurrent=tvNvwang
//                9->tvCurrent=tvNanshi
//                10->tvCurrent=tvLaonian
//                11->tvCurrent=tvJapanese
//                12->tvCurrent=tvIndian
//                13->tvCurrent=tvParis
//                14->tvCurrent=tvChinese
//                15->tvCurrent=tvBangong
//                16->tvCurrent=tvDitou
//                17->tvCurrent=tvJiache
//                18->tvCurrent=tvGaogen
//            }
//        }
    }

    override fun onClick(v: View?) {
//        if (v != tvCurrent) {
//            v?.isSelected = true
//            tvCurrent?.isSelected = false
//            tvCurrent = v as TextView?
//        }
//        when (v?.id) {
//            R.id.tv_dashi -> program = "1"
//            R.id.tv_taishi -> program = "2"
//            R.id.tv_guangjie -> program = "3"
//            R.id.tv_shujin -> program = "4"
//            R.id.tv_qingchen -> program = "5"
//            R.id.tv_huoli -> program = "6"
//            R.id.tv_taiji -> program = "7"
//            R.id.tv_nvwang -> program = "8"
//            R.id.tv_nanshi -> program = "9"
//            R.id.tv_laonian -> program = "10"
//            R.id.tv_japanese -> program = "11"
//            R.id.tv_indian -> program = "12"
//            R.id.tv_paris -> program = "13"
//            R.id.tv_chinese -> program = "14"
//            R.id.tv_bangong -> program = "15"
//            R.id.tv_ditou -> program = "16"
//            R.id.tv_jiache -> program = "17"
//            R.id.tv_gaogen -> program = "18"
//            R.id.tv_cancel -> {
////                program = ""
//                finish()
//            }
//            R.id.tv_confirm -> {
//                if (program.isNotEmpty()) {
//                    setResult(Activity.RESULT_OK, Intent().putExtra("program", program))
//                }
//                finish()
//            }
//        }
    }
}